package com.jay.compass.dialog;

import com.jay.compass.MainActivity;
import com.jay.compass.R;

import android.app.Dialog;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

public class RemoteIdDialog extends Dialog {

	private TextView currentTextView;
	private EditText idEditText;
	private Button okButton;
	private Button cancelButton;

	public RemoteIdDialog(Context context) {
		super(context);
		// TODO Auto-generated constructor stub
		setThisDialog();
		setTitle("设置短信ID");
	}

	private void setThisDialog() {
		View mView = LayoutInflater.from(getContext()).inflate(
				R.layout.dialog_set_remote_id, null);
		idEditText = (EditText) mView.findViewById(R.id.remote_id_editText);
		currentTextView = (TextView) mView.findViewById(R.id.current_id);
		currentTextView.setText("当前设置卡号为：" + MainActivity.PHONE_BEIDOU_ID);
		okButton = (Button) mView.findViewById(R.id.dialog_ok_button);
		cancelButton = (Button) mView.findViewById(R.id.dialog_cancel_button);
		super.setContentView(mView);
	}

	public void setCurrentId(String id) {
		currentTextView.setText("当前设置卡号为：" + id);
	}

	public void clearId() {
		idEditText.setText("");
	}

	public void setOnSendListener(View.OnClickListener listener) {
		okButton.setOnClickListener(listener);
	}

	public void setOnCancelListener(View.OnClickListener listener) {
		cancelButton.setOnClickListener(listener);
	}

	public String getRemoteId() {
		return idEditText.getEditableText().toString();
	}
}
